<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
<fmt:setBundle basename="ApplicationResources" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><fmt:message key="title.reviewScheduledProgram" /></title>
<script type="text/javascript">
      function updateOpener(str)
      {
     	  window.close(); 
     	  if (window.opener && !window.opener.closed) {
     		  window.opener.location.reload();
     		} 
   
      }
</script>
</head>
<body>
	<h2>
		<fmt:message key="title.reviewScheduledProgram" />
	</h2>
	<c:if test="${empty annualSchedules}">
		<form action="${pageContext.request.contextPath}/controller/reivewAnnualSchedule" method=post>
			<fmt:message key="caption.startResetSearch" />
			<input type="submit" value="Start Search /Reset">
		</form>
	</c:if>
	<c:if test="${! empty annualSchedules}">
		<form action="${pageContext.request.contextPath}/controller/reviewWeeklySchedule" method=post>
			<fmt:message key="caption.reviewScheduledProgram" />
			<table class="framed">
				<tr>
					<td>
						<select name="annualScheduleId">
							<c:forEach items="${annualSchedules}" var="as">
								<option value="${as.year}">Year ${as.year}</option>
							</c:forEach>
						</select>
					</td>
					<td><input type="submit" value="Search"> </td>
				</tr>
			</table>
		</form>
	</c:if>
	
	<c:if test="${! empty weeklySchedules}">
		<form action="${pageContext.request.contextPath}/controller/reivewProgramSlot" method=post>
			<fmt:message key="caption.selectWeeklySchedule" />
			<table class="framed">
				<tr>
					<td>
						<select name="weeklyScheduleId">
							<c:forEach items="${weeklySchedules}" var="ws">
									<option value="${ws.id}">Week ${ws.weekNumber}</option>
							</c:forEach>
							</select>
						
						</td>
					<td><input type="submit" value="Search"> </td>
				</tr>
			</table>
		</form>
	</c:if>
	<c:if test="${! empty weeklySchedule}">
	<script>
		updateOpener();
    </script>
	</c:if>
</body>
</html>